<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Bootstrap -->
	    <link href="./Public/admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="./Public/admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
	    <link href="./Public/admin/Flat/docs/assets/css/demo.css" rel="stylesheet">
	    <link rel="shortcut icon" href="./Public/admin/Flat/img/favicon.ico">
	    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
	    <!--[if lt IE 9]>
	      <script src="dist/js/vendor/html5shiv.js"></script>
	      <script src="dist/js/vendor/respond.min.js"></script>
	    <![endif]-->
	    <script>
	    var num=2;
			function myFunction(){
				
				var node=document.createElement("tr");
				var html = '<td><input id="exampleInputEmail1" class="form-control" type="text" placeholder="请输入属性名称"  name="attr_1[]"></td><td><label class="radio-inline"><input type="radio" name="attr_1[]" id="inlineRadio1" value="0"> 属性</label><label class="radio-inline"><input type="radio" name="attr_1[]" id="inlineRadio2" value="1"> 规格</label></td><td><input id="exampleInputEmail1" class="form-control" type="text" placeholder="属性值(多个值用 竖线 | 分隔)"  name="attr_1[]"></td>';
				//console.log(html.replace(/attr_1/g,'attr_'+num));
				node.innerHTML=html.replace(/attr_1/g,'attr_'+num);
				
				document.getElementById("mytable").appendChild(node);
				num++;
			}
		</script>
	</head>
	<body>
		<form action="" method="post">
		<input type="hidden"  name="tid" value="{{$dbdata['tid']}}">
		
		<div class="alert alert-success">添加类型</div>
		<div class="form-group">
			<label for="exampleInputEmail1">类型名称</label>
			<input id="exampleInputEmail1" class="form-control" type="text" placeholder="请输入分类名称"  name="tname" value="{{$dbdata['tname']}}">
		</div>
		
		<label for="exampleInputEmail1">类型属性</label>
		<table class="table table-hover">
			<tbody id='mytable'>
			<tr class="active">
			  <th width="200">属性名称</th>
			  <th width="200">属性类别</th>
			  <th >属性值</th>
			</tr>
			{{foreach from="$attrs" value="$v"}}
			<tr>
				<td>
					<input id="exampleInputEmail1" class="form-control" type="text" placeholder="请输入属性名称"  name="editattr_{{$v['taid']}}[]" value="{{$v['taname']}}">
				</td>
				<td>
					<label class="radio-inline">
					  <input type="radio" name="editattr_{{$v['taid']}}[]" id="inlineRadio1" value="0" checked> 属性
					  
					</label>
					<label class="radio-inline">
					  <input type="radio" name="editattr_{{$v['taid']}}[]" id="inlineRadio2" value="1"> 规格
					</label>
				</td>
				
				<td>
					<input id="exampleInputEmail1" class="form-control" type="text" placeholder="属性值(多个值用 竖线 | 分隔)"  name="editattr_{{$v['taid']}}[]" value="{{$v['tavalue']}}">
				</td>
				
			</tr>
			{{endforeach}}
			</tbody>
			
			
		</table>
		<button type="button" class="btn btn-info" onclick="myFunction()" style="margin-bottom: 20px"> 添加属性 </button>
	
		<button class="btn btn-primary btn-block" type="submit"> 确定 </button>
			
		</form>
	</body>
</html>
